<cfsilent>
	<cfset error = $.request.getValue('error') />
	
</cfsilent>
<cfoutput>
	<cfsavecontent variable="page">
		<cfif error eq 'true'>
			#application.core.renderRedirectError()#
		</cfif>
		
		<a class="widget dashboard" id="setup_your_business" href="#$.site.getVar('rootURL')#/craftivity/setup.cfm" >
			<div class="dashboard-title">Set Up Your Business</div>
			#$.render.img(path="craftivity/widget_icons/worksheet.png")#</br>
			<div class="widget-subtext">Tell us about yourself</div>
		</a>
	
			<a class="widget dashboard widget-calendar" href="#$.site.getVar('rootURL')#/craftivity/calendar.cfm">
			<div class="dashboard-title">Calendar</div>
			#$.render.img(path="craftivity/widget_icons/calendar.png")#</br>
			<!--- <div class="widget-subtext">4 events today</div> --->
			<div class="widget-subtext">Schedule Your Events</div>
		</a>
		
		<a href="#$.site.getVar('rootURL')#/craftivity/goals.cfm" class="widget dashboard widget-goals">
			<div class="dashboard-title">Goals and Milestones</div>
			#$.render.img(path="craftivity/widget_icons/trophy.png")#</br>
			<div class="widget-subtext">and action plans</div>
		</a>
		
		<a href="#$.site.getVar('rootURL')#/craftivity/workweek.cfm" class="widget dashboard widget-workweek">
			<div class="dashboard-title">Workweek Designer</div>
			#$.render.img(path="craftivity/widget_icons/clock.png")#</br>
			<div class="widget-subtext">What does your perfect week look like?</div>
		</a>
		
		<script>
			SneakPeek = {
				toggle:function($widget){
					if($widget.hasClass('changing')){
						return;
					}
					$widget.addClass('changing');
					var $normal = $widget.find('.normal');
					var $sneak = $widget.find('.sneak-peek');
					if($widget.hasClass('peeking')){
						$sneak.fadeOut(function(){
							$normal.fadeIn(function(){
								$widget.removeClass('changing');
								$widget.removeClass('peeking');
							});
						});
					} else {
						$normal.fadeOut(function(){
							$sneak.fadeIn(function(){
								$widget.removeClass('changing');
								$widget.addClass('peeking');
							});
						});
					}
				}
			};
			$(document).ready(function(){
				$('.corner-icon').each(function(){
					var $widget = $(this).closest('.widget');
					$widget.click(function(){
						SneakPeek.toggle($(this));
					});
				});
			});
		</script>
		
		<div class="widget dashboard" style="cursor:pointer;">
			<div class="dashboard-title">Brainstorm Journals</div>
		
			<div class="normal">
				#$.render.img(path="craftivity/widget_icons/lightbulb.png")#</br>
				<div class="widget-subtext">Guided brainstorming</div>
			</div>
			<div class="sneak-peek" style="display:none;">
				What direction do you want to take your business?</br>
				When did you last think about your priorities?</br></br>
				Our journals are exploratory activities</br>
				designed to help you find these answers.
			</div>
			
			<div class="corner-icon incomplete"><div class="corner-icon-text">Under Construction</div></div>
			<i class="fa fa-lock" title="Under Construction"></i>
		</div>
		
		<div class="widget dashboard" style="cursor:pointer;">
			<div class="dashboard-title">Discussion Hub</div>
			
			<div class="normal">
				#$.render.img(path="craftivity/widget_icons/forums.png")#</br>
				<div class="widget-subtext">What are we talking about today?</div>
			</div>
			<div class="sneak-peek" style="display:none;">
				Share your ideas. Ask your questions.</br>
				Leverage the knowledge </br>
				of the Craftivity Community.
			</div>
			
			<div class="corner-icon incomplete"><div class="corner-icon-text">Under Construction</div></div>
			<i class="fa fa-lock" title="Under Construction"></i>
		</div>
		
		<div class="widget dashboard" style="cursor:pointer;">
			<div class="dashboard-title">Craftivity Groups</div>
			
			<div class="normal">
				#$.render.img(path="craftivity/widget_icons/community.png")#</br>
				<div class="widget-subtext">Find and connect with others like you</div>
			</div>
			<div class="sneak-peek" style="display:none;">
				Who's in your business support network?</br>
				Create a group and seek out new connections</br>
				or apply to join an existing group.</br></br>
				You don't have to do this alone.
			</div>

			<div class="corner-icon future"><div class="corner-icon-text">Future Development</div></div>
			<i class="fa fa-lightbulb-o" title="Future development"></i>
		</div>
		
		<div class="widget dashboard" style="cursor:pointer;">
			<div class="dashboard-title">Business Statistics</div>
			
			<div class="normal">
				#$.render.img(path="craftivity/widget_icons/graph.png")#</br>
				<div class="widget-subtext">Charting your growth</div>
			</div>
			<div class="sneak-peek" style="display:none;">
				Record and monitor your business metrics</br>
				You can't learn from patterns if you can't see them</br></br>
				Who doesn't appreciate upward trending graphs?
			</div>

			<div class="corner-icon future"><div class="corner-icon-text">Future Development</div></div>
			<i class="fa fa-lightbulb-o" title="Future development"></i>
		</div>
		
		<a class="widget hidden dashboard">
			<div class="dashboard-title">Your Services</div>
			#$.render.img(path="craftivity/widget-worksheet.png")#</br>
			<div class="widget-subtext">0 services tagged</div>
		</a>
		
		<a class="widget hidden dashboard">
			<div class="dashboard-title">2015 Preparation</div>
			#$.render.img(path="craftivity/widget-worksheet.png")#</br>
			<div class="widget-subtext">264 days to go</div>
		</a>
		
		<a class="widget hidden dashboard">
			<div class="dashboard-title">Options</div>
			#$.render.img(path="craftivity/widget-settings.png")#</br>
			<div class="widget-subtext">Tweak Crafitivity</div>
		</a>
		
		<a class="widget hidden dashboard">
			<div class="dashboard-title">Billing</div>
			#$.render.img(path="craftivity/widget-settings.png")#</br>
			<div class="widget-subtext">Next bill date 4/15</div>
		</a>
		
		<a class="widget hidden dashboard" href="#$.site.getVar('rootURL')#/craftivity/groups.cfm">
			<div class="dashboard-title">Craftivity Groups</div>
			#$.render.img(path="craftivity/widget_icons/lightbulb.png")#</br>
			<div class="widget-subtext">Find or Start a group</div>
		</a>
		
		<cfif request.session.user.admin eq 1>
			<cfset user = $.run.it('craftivityService.getUser',{userID=request.session.user.id}) />
			<cfset discussions = $.run.it('discussionService.getDiscussions',{
				checked_forum=datetimeFormat(user.checked_forum,'yyyy-mm-dd HH:nn:ss'),
				followers=true,
				userID=""
			}) />
			<audio id="ding" src="/assets/media/craftivity/ding.mp3"></audio>
			<cfif discussions.recordcount gt 0>
				<script>
					try{
						document.getElementById('ding').play();
					} catch(e){
						console.log('oops');
					}
				</script>
			</cfif>
			<a class="widget dashboard" href="#$.site.getVar('rootURL')#/craftivity/forum_admin.cfm">
				<div class="dashboard-title">Forum Administration</div>
				#$.render.img(path="craftivity/widget_icons/adminforum.png")#</br>
				<div class="widget-subtext"><span style="<cfif discussions.recordcount gt 0>color:red;</cfif>">#discussions.recordcount# new discussions</span></div>
			</a>
		</cfif>
		
		<cfif request.session.user.admin eq 1>
			<a class="widget dashboard" href="#$.site.getVar('rootURL')#/craftivity/errors.cfm">
				<div class="dashboard-title">Errors</div>
				#$.render.img(path="craftivity/widget_icons/code.png")#</br>
				<div class="widget-subtext">Such errors</div>
			</a>
		</cfif>
		
		<cfif request.session.user.admin eq 1>
			<a class="widget dashboard" href="#$.site.getVar('rootURL')#/craftivity/worksheet_designer.cfm">
				<div class="dashboard-title">Worksheet Designer</div>
				#$.render.img(path="craftivity/widget_icons/book.png")#</br>
				<div class="widget-subtext">Admin only</div>
			</a>
		</cfif>
		
		<cfif request.session.user.admin eq 1>
			<a class="widget dashboard" href="#$.site.getVar('rootURL')#/craftivity/user_management.cfm">
				<div class="dashboard-title">User Management</div>
				#$.render.img(path="craftivity/widget_icons/lightbulb.png")#</br>
				<div class="widget-subtext">Admin only</div>
			</a>
		</cfif>
		
		<!--- terms of service --->
		<cfif not structKeyExists(request.session.user,'agreement')>
			<!--- invalidate cache on this user --->
			<cfset local.user = $.run.it('craftivityService.getUser',{userID=request.session.user.id,invalidateCache=true}) />
			
			<!--- update request with user values --->
			<cfset application.session.pushUserToSession(local.user) />
		</cfif>
		<cfif request.session.user.agreement neq 1>
			#$.run.it('craftivityView.renderTOS')#
		</cfif>
	</cfsavecontent>

	#application.v.craftivityView.renderPage(page)#

</cfoutput>
